namespace :bootstrap do
  desc "Add the default collections"
  task :default_collections => :environment do
    Collection.create( :id => 1, :title => 'Naruto' )
    Collection.create( :id => 2, :title => 'One Piece' )
  end

  desc "Add the default books"
  task :default_books => :environment do
    Book.create( :title => '1', :price => 6.75, :collection_id => 1)
    Book.create( :title => '2', :price => 6.75, :collection_id => 1)
    Book.create( :title => '3', :price => 6.75, :collection_id => 1)
    Book.create( :title => '1', :price => 7.90, :collection_id => 2)
    Book.create( :title => '2', :price => 7.90, :collection_id => 2)
  end

  desc "Add the default admin account"
  task :default_users => :environment do
    User.create( :login => 'admin', :admin => true, :mail => 'admin@mangalib.fr',  :password => 'admin1234')
  end

  desc "Run all bootstrapping tasks"
  task :all => [:default_collections, :default_books, :default_users]
end
